import { Component, ViewChild } from '@angular/core';

import { NavController, Slides } from 'ionic-angular';

import { Storage } from '@ionic/storage';

import { LoginPage } from '../login/login.component';

import { Config } from '../../providers/config';


@Component({
  selector: 'page-tutorial',
  templateUrl: 'tutorial.html'
})

export class TutorialPage {
	moa_page_name: any = "page-tutorial";
  moa_page_explain: any = "引导页面";

  showSkip = true;

  @ViewChild('slides') slides: Slides;

  constructor(
    public navCtrl: NavController,
    public storage: Storage,
    public config: Config
  ) { }

  startApp() {
    this.navCtrl.push(LoginPage).then(() => {
      this.storage.set('hasSeenTutorial-' + this.config.tutorialVersion, 'true');
    })
  }

  onSlideChangeStart(slider: Slides) {
    this.showSkip = !slider.isEnd();
  }

  ionViewWillEnter() {
    this.slides.update();
  }
}
